<template>
  <div class="school">
    <h2 @click="showName">学校姓名：{{ name | mySlice }}</h2>
    <h2>学校地址：{{ address }}</h2>
  </div>
</template>

<script>
// 局部混合
import {showName} from "@/mixins";

export default {
  name: "School",
  data() {
    return {
      name: "ABC12312321",
      address: "深圳",
    }
  },
  methods: {
    test(e) {
      this.hello();
    },
    sendSchoolName(name){
      this.appGetSchoolName(name);
    }
  },
  computed: {},
  components: {},
  mixins: [showName],
  watch: {},
  filters: {},
  directives: {},
  props:['appGetSchoolName'],
  mounted() {
    this.$bus.$on('hello', (data) => {
      console.log('School收到了数据：', data);
    });
  },
  beforeDestroy() {
    this.$bus.$off('hello');
  }
}
</script>

<style scoped>
.school {
  background-color: skyblue;
  padding: 5px;
}
</style>